<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>在线充值</title>
    <style>
        *,
        ::before,
        ::after {
            margin: 0;
            padding: 0;
            /*清除webkit内核点击默认的高亮效果*/
            -webkit-tap-highlight-color: transparent;
            /*以border开始计算盒子宽度*/
            -webkit-box-sizing: border-box;
        }

        html, body {
            width: 100%;
            height: 100%;
            background-color: #f5f5f5;
        }

        body {
            font-size: 14px;
            font-family: 'Arial', "Microsoft YaHei UI", "sans-serif";
            color: #333333;
        }

        .title {
            color: #737373;
            font-size: 1.2em;
            font-weight: normal;
            padding: 10px 0 5px 20px;
        }

        .option {
            border: 1px solid #f0f0f0;
            border-left-width: 0;
            border-right-width: 0;
            background-color: #ffffff;
            background-color: #124d9e;
            font-size: 1.2em;
        }

        .option > ul > li {
            padding-left: 20px;
        }

        .option > ul > li:active {
            background-color: #f5f5f5;
        }

        .option > ul > li > p {
            padding: 8px 0 8px 22px;
            position: relative;
        }

        .option > ul > li > p:before {
            content: "";
            position: absolute;
            top: 13px;
            left: 2px;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            border: 1px solid #cccccc;
        }

        .option > ul > li > p.select:before {
            border: 0;
            background-color: orange;
        }

        .option > ul > li + li > p {
            border-top: 1px solid #f5f5f5;
        }

        .btn {
            width: 90%;
            margin: 15px auto;
            display: block;
            border: 0;
            background-color: #04BE01;
            color: white;
            font-size: 1.2em;
            padding: 10px 0;
            border-radius: 5px;
        }

        .btn:active {
            background-color: #04a701;
        }


    </style>
</head>
<body>
<h3 class="title">在线充值</h3>
<div class="option" id="options">
    <ul>
        <li><p class="select">1元</p></li>
        <li><p>10元</p></li>
        <li><p>20元</p></li>
        <li><p>50元</p></li>
        <li><p>200元</p></li>
        <li><p>100元</p></li>
        <li><p>500元</p></li>
    </ul>
</div>

<button class="btn" id="submit">立即充值</button>

<script>
    window.onload = function () {
        var lis = document.getElementById("options").children[0].children;
        for (var i = 0; i < lis.length; i++) {
            var obj = lis[i];
            obj.index = i;
            obj.addEventListener("click", function () {
                for (var j = 0; j < lis.length; j++) {
                    lis[j].children[0].className = "";
                }
                this.children[0].className = "select";
            })
        }

        //按钮
        var btn = document.getElementById("submit");
        btn.addEventListener("click", function () {
            for (var i = 0; i < lis.length; i++) {
                var obj = lis[i];
                if (obj.children[0].className == "select") {
                    console.log(obj.children[0].innerHTML);
                    alert(obj.children[0].innerHTML);
                    return;
                }
            }
        })
    }
</script>
</body>
</html>